package com.wkr.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class AopTest {

    private Logger logger = LoggerFactory.getLogger(AopTest.class);

    public void before() {
        logger.info("准备消息-前置通知");
    }

    public void afterReturn(Object returnVal){
        logger.info("发送完毕-后置通知" + returnVal);
    }
    public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
        logger.info("发送消息-环绕通知前");
        Object object= joinPoint.proceed();
        logger.info("发送消息-环绕通知后");
        return object;
    }
    public void afterThrowing(Throwable throwable){
        logger.info("发送消息-异常通知:"+ throwable.getMessage());
    }
    public void after(){
        logger.info("消息结束-最终通知");
    }
}

